/*
This is an example script for a rectangle. Click the Execute button to apply and then execute this script. Upon each execution the rectangle alters its appearance. Turn on animation to execute periodically.
*/

/* Declaration blocks */

double cos(double a);
double sin(double a);

@@class() Rectangle:Object

@@method(public, class) (id)stored;
@@method(public, instance) (unsigned)animationCount;
@@method(public, instance) (void)sizeToCenteredWidth:(double)width height:(double)height;
@@method(public, instance) (void)moveCenterToXValue:(double)xValue yValue:(double)yValue;
@@method(public, instance) (void)setInteriorRed:(double)red green:(double)green blue:(double)blue alpha:(double)alpha;

@@end

/* Execution block */

{
id myRectangle;
unsigned animationCount;
double radius, width, height;
double red, green, blue;

myRectangle = [Rectangle stored];

animationCount = [myRectangle animationCount];

radius = 90.0 + 40.0 * cos(animationCount * 0.15 + 0.1);
width = 2.0 * radius;
height = 2.0 * radius;

red = 0.7;
green = 0.5;
blue = 0.2;

[myRectangle sizeToCenteredWidth:width height:height];
[myRectangle setInteriorRed:red green:green blue:blue alpha:1.0];

}
